DevForce Help Reference
GroupBy<TSource,TKey,TElement,TResult>(IEntityQuery<TSource>,Expression<Func<TSource,TKey>>,Expression<Func<TSource,TElement>>,Expression<Func<TKey,IEnumerable<TElement>,TResult>>) Method
Example 


Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function.
Syntax

Parameters

source
keySelector
elementSelector
resultSelector

Type Parameters

TSource
TKey
TElement
TResult
Example
var mgr = new DomainModelEntityManager();

var query = mgr.Customers.GroupBy(c => c.Country, c => c.CompanyName, (s, a) => new { Key = s, Count = a.Count() });
  //(s, c) => new { Key=s, Count=c.Count()});
foreach (var group in query) {
  Console.WriteLine("key = " + group.Key);
  Console.WriteLine("count=" + group.Count);
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

EntityQueryExtensions Class
EntityQueryExtensions Members
Overload List

Send Feedback